export { guard }
import { redirect, render } from 'vike/abort'
import type { PageContext } from 'vike/types'
import type { GuardAsync } from 'vike/types'
/* 针对服务端 */
const guard: GuardAsync = async (pageContext): ReturnType<GuardAsync> => {
    console.log('guard', pageContext)
    if (!(pageContext.data as any)) {
        // 可以抛出异常，也可以使用 redirect 函数
        // throw render(401, "You aren't allowed to access this page.")
        // throw redirect('/about')
    }
}